package fr.neyb.wesb.core.data.descriptors.field.impl;

import java.util.Comparator;

import fr.neyb.wesb.core.data.compare.FieldComparatorManager;
import fr.neyb.wesb.core.data.compare.Order;
import fr.neyb.wesb.core.data.content.Field;

public class SimpleComparableTypedFieldDescriptorImpl {

	private Class<? extends Comparator<Field>> compClass;

	public SimpleComparableTypedFieldDescriptorImpl(
			Class<? extends Comparator<Field>> compClass) {
		this.compClass = compClass;
	}

	public Class<? extends Comparator<Field>> getComparatorClass() {
		return compClass;
	}

	public void setComparatorClass(Class<? extends Comparator<Field>> compClass) {
		this.compClass = compClass;
	}

	public Comparator<Field> getComparator(Order o) {
		return FieldComparatorManager.getInstance().getFieldComparator(getComparatorClass(), o);
	}

}
